Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix an issue in PartitionGatherTrivialSlicedOperandDimensions when handling out-of-bound indices. #20401

Merged
merged 1 commit into from
Dec 13, 2024

Conversation

copybara-service[bot]
Copy link

Fix an issue in PartitionGatherTrivialSlicedOperandDimensions when handling out-of-bound indices.

A gather operation will clamp the fetched indices such that we always retrieve the corresponding entries in the operand. However, the result of PartitionGatherTrivialSlicedOperandDimensions will do not handle these indices. Namely, if the indices is out of bound, we do not retrieve the entries from the operand and the result is 0.

This is a execution bug in SPMD partitioner in both GSPMD and Shardy. The compilation succeeds. This issue does not exist in scatter since scatter does not need to clamp the indices.

This change fixes this issue by clamping the indices at the very beginning of PartitionGatherTrivialSlicedOperandDimensions.

@copybara-service copybara-service bot force-pushed the test_704842079 branch 3 times, most recently from dfc2f90 to 0dda26d Compare December 13, 2024 00:35
…handling out-of-bound indices.

A gather operation will clamp the fetched indices such that we always retrieve the corresponding entries in the operand. However, the result of `PartitionGatherTrivialSlicedOperandDimensions` will do not handle these indices. Namely, if the indices is out of bound, we do not retrieve the entries from the operand and the result is 0.

This is a execution bug in SPMD partitioner in both GSPMD and Shardy. The compilation succeeds. This issue does not exist in scatter since scatter does not need to clamp the indices.

This change fixes this issue by clamping the indices at the very beginning of `PartitionGatherTrivialSlicedOperandDimensions`.

PiperOrigin-RevId: 705678305
@copybara-service copybara-service bot merged commit a803260 into main Dec 13, 2024
@copybara-service copybara-service bot deleted the test_704842079 branch December 13, 2024 01:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant